package com.huang.dao;

import com.huang.pojo.User;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;

public class UserMapperImpl extends SqlSessionDaoSupport implements UserMapper {
    @Override
    public List<User> select() {
        User user=new User(5,"狂神","963258");
        UserMapper mapper = getSqlSession().getMapper(UserMapper.class);
        mapper.add(user);
        mapper.delete(5);
        return mapper.select();
    }

    @Override
    public int add(User user) {
        user=new User(5,"狂神","963258");
        return getSqlSession().getMapper(UserMapper.class).add(user);
    }

    @Override
    public int delete(int id) {
        return getSqlSession().getMapper(UserMapper.class).delete(id);
    }
}
